package 数列.单调数列;

/**
 * TODO
 *
 * @className: ddsl
 * @description: TODO
 * @author: 等什么柠檬君
 * @date: 2022-04-27 20:36
 **/
public class ddsl {

    public static void main(String[] args) {
       int[] nums = {6,5,4,4};
        System.out.println(isMonotonic(nums));
    }

    public static boolean isMonotonic(int[] nums) {
        int flag1 = 0;
        int flag2 = 0;
        for(int i = 0;i < nums.length-1; ++i){
            if(nums[i] <= nums[i+1]){
                flag1++;
            }
            if(nums[i] >= nums[i+1]){
                flag2++;
            }
        }
        System.out.println(flag1);
        System.out.println(flag2);
        if(flag1==nums.length-1 || flag2==nums.length-1){
            return true;
        }
        return false;
    }
}
